const gulp = require("gulp"),
      shell = require("shelljs");


//初始化android平台环境
gulp.task("prepare-android", ()=> {
    return shell.exec("ionic platform add android")
});

//构建android应用
gulp.task("build-android", ()=> {
    return shell.exec("ionic build android --release")
});

//直接打签名包
gulp.task("build-a-sign", ["build-android", "sign-app"]);

//打一个测试包
gulp.task("build-a", function () {
    return shell.exec("ionic build android");
});

//生成kestore
gulp.task("generate-keystore", ()=> {
    return shell.exec("keytool -genkey -v -keystore angular2ionic2.keystore -alias angular2ionic2 -keyalg RSA -keysize 2048 -validity 10000")
});

//签名app
gulp.task("sign-app", ()=>{
    return shell.exec("jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -storepass jeasonnow -keypass jeasonnow -keystore platforms/android/angular2ionic2.keystore platforms/android/build/outputs/apk/android-release-unsigned.apk angular2ionic2");
});
